package xyz.hubery.constant;


public class LoginConstant {

    /**
     * 管理员登陆
     */
    public static final String ADMIN_TYPE = "admin_type";

    /**
     * 会员登陆
     */
    public static final String MEMBER_TYPE = "member_type";


    /**
     * 查询管理员
     */
    public static final String QUERY_ADMIN_SQL =
            "SELECT `id` ,`username`, `password`, `status` FROM sys_user WHERE username = ? ";


    /**
     * 查询角色CODE
     */
    public static final String QUERY_ROLE_CODE_SQL =
            "SELECT `code` FROM sys_role LEFT JOIN sys_user_role ON sys_role.id = sys_user_role.role_id WHERE sys_user_role.user_id= ?";


    /**
     * 当角色为管理员时，查询所有的权限
     */
    public static final String QUERY_ALL_PERMISSIONS =
            "SELECT `name` FROM sys_privilege";


    /**
     * 普通用户查询对应权限
     */
    public static final String QUERY_PERMISSION_SQL =
            "SELECT `name` FROM sys_privilege LEFT JOIN sys_role_privilege ON sys_role_privilege.privilege_id = sys_privilege.id LEFT JOIN sys_user_role ON sys_role_privilege.role_id = sys_user_role.role_id WHERE sys_user_role.user_id = ?";


    /**
     * 管理员角色COED
     */
    public static final String ADMIN_ROLE_CODE = "ROLE_ADMIN";


    /**
     * 查询会员用户
     */
    public static final String QUERY_MEMBER_SQL =
            "SELECT `id`,`password`, `status` FROM `user` WHERE mobile = ? or email = ? ";

    /**
     * token 的刷新
     */
    public static final String REFRESH_TOKEN = "REFRESH_TOKEN" ;

    /**
     * 使用用户的 id 查询用户名称
     */
    public static final String QUERY_ADMIN_USER_WITH_ID = "SELECT `username` FROM sys_user where id = ?" ;

    /**
     * 使用用户的 id 查询用户名称
     */
    public static final String QUERY_MEMBER_USER_WITH_ID = "SELECT `mobile` FROM user where id = ?" ;


}
